package app.sceledroid.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import app.sceledroid.R;
import app.sceledroid.entity.Profile;

public class ProfileAdapter extends ArrayAdapter<Profile> {

	private ArrayList<Profile> Profiles;

	public ProfileAdapter(Context context, int textViewResourceId,
			ArrayList<Profile> Profiles) {
		super(context, textViewResourceId, Profiles);
		this.Profiles = Profiles;

		// TODO Auto-generated constructor stub
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View v = convertView;
		if (v == null) {
			Context context = super.getContext();
			LayoutInflater vi = (LayoutInflater) context
					.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			v = vi.inflate(R.layout.direct_email_item, null);
		}
		Profile c = Profiles.get(position);
		if (c != null) {

			Log.d("DEBUG", v.findViewById(R.id.profileName).toString());

			TextView name = (TextView) v.findViewById(R.id.profileName);
			TextView email = (TextView) v.findViewById(R.id.profileEmail);
			// if (text != null) {
			name.setText(c.getName());
			name.setTextSize(25);
			
			email.setText(c.getEmail());
			email.setTextSize(15);

		}
		return v;
	}
}
